home *** CD-ROM | disk | FTP | other *** search
/ Aminet 1 (Walnut Creek) / Aminet - June 1993 [Walnut Creek].iso / usenet / sources / volume2 / editors / dme1315.of6 < prev    next >
Text File  |  1988-10-22  |  41KB  |  1,964 lines

  1. Path: xanth!nic.MR.NET!hal!cwjcc!mailrus!uflorida!gatech!bbn!ulowell!page
  2. From: page@swan.ulowell.edu (Bob Page)
  3. Newsgroups: comp.sources.amiga
  4. Subject: v02i013:  dme - programmer's text editor V1.31, Part05/06
  5. Message-ID: <9775@swan.ulowell.edu>
  6. Date: 22 Oct 88 04:35:14 GMT
  7. Organization: University of Lowell, Computer Science Dept.
  8. Lines: 1953
  9. Approved: page@swan.ulowell.edu
  10.  
  11. Submitted-by: dillon@cory.berkeley.edu (Matt Dillon)
  12. Posting-number: Volume 2, Issue 13
  13. Archive-name: editors/dme131.5of6
  14.  
  15. # This is a shell archive.  Remove anything before this line
  16. # then unpack it by saving it in a file and typing "sh file"
  17. # (Files unpacked will be owned by you and have default permissions).
  18. # This archive contains the following files:
  19. #    ./rexmacs/swish2.dme
  20. #    ./rexmacs/xyz1.dme
  21. #    ./rexmacs/args.dme
  22. #    ./rexmacs/second.dme
  23. #    ./rexmacs/yy.dme
  24. #    ./rexmacs/one.dme
  25. #    ./rexmacs/putd.dme
  26. #    ./rexmacs/two.dme
  27. #    ./rexmacs/interr2.dme
  28. #    ./rexmacs/swish.dme
  29. #    ./rexmacs/xx.dme
  30. #    ./rexmacs/three.dme
  31. #    ./rexmacs/alley.dme
  32. #    ./rexmacs/save.dme
  33. #    ./rexmacs/xyz2.dme
  34. #    ./rexmacs/rxtop.dme
  35. #    ./rexmacs/addr.dme
  36. #    ./rexmacs/zz.dme
  37. #    ./rexmacs/bot.dme
  38. #    ./rexmacs/cat.dme
  39. #    ./rexmacs/get.dme
  40. #    ./rexmacs/findrexx.dme
  41. #    ./rexmacs/qq.dme
  42. #    ./rexmacs/rxbot.dme
  43. #    ./rexmacs/findbaz.dme
  44. #    ./rexmacs/put.dme
  45. #    ./rexmacs/interr.dme
  46. #    ./src/rexx.h
  47. #    ./src/defs.h
  48. #    ./src/cmd1.c
  49. #
  50. if `test ! -d ./rexmacs`
  51. then
  52.   mkdir ./rexmacs
  53.   echo "mkdir ./rexmacs"
  54. fi
  55. if `test ! -s ./rexmacs/swish2.dme`
  56. then
  57. echo "writing ./rexmacs/swish2.dme"
  58. cat > ./rexmacs/swish2.dme << '\Rogue\Monster\'
  59. /* test to see if we can invoke ARexx from inside of dme .... */
  60.  
  61. swish
  62. bottom
  63. top
  64. bottom
  65. top
  66. bottom
  67. top
  68. bottom
  69. top
  70. bottom
  71. top
  72. find "........"
  73. exit 0
  74.  
  75. \Rogue\Monster\
  76. else
  77.   echo "will not over write ./rexmacs/swish2.dme"
  78. fi
  79. if [ `wc -c ./rexmacs/swish2.dme | awk '{printf $1}'` -ne 151 ]
  80. then
  81. echo `wc -c ./rexmacs/swish2.dme | awk '{print "Got " $1 ", Expected " 151}'`
  82. fi
  83. if `test ! -s ./rexmacs/xyz1.dme`
  84. then
  85. echo "writing ./rexmacs/xyz1.dme"
  86. cat > ./rexmacs/xyz1.dme << '\Rogue\Monster\'
  87. /* test to see if we can invoke ARexx from inside of dme .... */
  88.  
  89. parse source a b c d e f g h i
  90. say a b c d e f g h i
  91. parse arg j k l m n o
  92. say j k l m n o
  93. say xyz1
  94. say "xyz1 - calling xyz2"
  95. xyz2  j k l m n o
  96. exit 0
  97.  
  98. \Rogue\Monster\
  99. else
  100.   echo "will not over write ./rexmacs/xyz1.dme"
  101. fi
  102. if [ `wc -c ./rexmacs/xyz1.dme | awk '{printf $1}'` -ne 218 ]
  103. then
  104. echo `wc -c ./rexmacs/xyz1.dme | awk '{print "Got " $1 ", Expected " 218}'`
  105. fi
  106. if `test ! -s ./rexmacs/args.dme`
  107. then
  108. echo "writing ./rexmacs/args.dme"
  109. cat > ./rexmacs/args.dme << '\Rogue\Monster\'
  110. /* test to look at what dme is passing to ARexx .... */
  111.  
  112. parse source a b c d e f g h i
  113. say a b c d e f g h i
  114. parse arg a1 a2 a3 a4 a5 a6
  115. say a1 a2 a3 a4 a5 a6
  116. exit 0
  117.  
  118. \Rogue\Monster\
  119. else
  120.   echo "will not over write ./rexmacs/args.dme"
  121. fi
  122. if [ `wc -c ./rexmacs/args.dme | awk '{printf $1}'` -ne 168 ]
  123. then
  124. echo `wc -c ./rexmacs/args.dme | awk '{print "Got " $1 ", Expected " 168}'`
  125. fi
  126. if `test ! -s ./rexmacs/second.dme`
  127. then
  128. echo "writing ./rexmacs/second.dme"
  129. cat > ./rexmacs/second.dme << '\Rogue\Monster\'
  130. /* test to see if we can invoke ARexx from inside of dme .... */
  131.  
  132. parse source a b c d e f g h i
  133. say a b c d e f g h i
  134. parse arg j k l m n o
  135. say j k l m n o
  136. cat
  137. exit 0
  138.  
  139. \Rogue\Monster\
  140. else
  141.   echo "will not over write ./rexmacs/second.dme"
  142. fi
  143. if [ `wc -c ./rexmacs/second.dme | awk '{printf $1}'` -ne 169 ]
  144. then
  145. echo `wc -c ./rexmacs/second.dme | awk '{print "Got " $1 ", Expected " 169}'`
  146. fi
  147. if `test ! -s ./rexmacs/yy.dme`
  148. then
  149. echo "writing ./rexmacs/yy.dme"
  150. cat > ./rexmacs/yy.dme << '\Rogue\Monster\'
  151. /* test to see if we can invoke ARexx from inside of dme .... */
  152.  
  153. zz
  154. bottom
  155. top
  156. bottom
  157. top
  158. bottom
  159. top
  160. bottom
  161. top
  162. bottom
  163. top
  164. find "........"
  165. zz
  166. exit 0
  167.  
  168. \Rogue\Monster\
  169. else
  170.   echo "will not over write ./rexmacs/yy.dme"
  171. fi
  172. if [ `wc -c ./rexmacs/yy.dme | awk '{printf $1}'` -ne 151 ]
  173. then
  174. echo `wc -c ./rexmacs/yy.dme | awk '{print "Got " $1 ", Expected " 151}'`
  175. fi
  176. if `test ! -s ./rexmacs/one.dme`
  177. then
  178. echo "writing ./rexmacs/one.dme"
  179. cat > ./rexmacs/one.dme << '\Rogue\Monster\'
  180. /* test to see if we can invoke ARexx from inside of dme .... */
  181.  
  182. parse source a b c d e f g h i
  183. say a b c d e f g h i
  184. parse arg j k l m n o
  185. say j k l m n o
  186. say "one ... calling two"
  187. two
  188. say "back to one"
  189. top
  190. three
  191. bottom
  192. exit 0
  193.  
  194. \Rogue\Monster\
  195. else
  196.   echo "will not over write ./rexmacs/one.dme"
  197. fi
  198. if [ `wc -c ./rexmacs/one.dme | awk '{printf $1}'` -ne 230 ]
  199. then
  200. echo `wc -c ./rexmacs/one.dme | awk '{print "Got " $1 ", Expected " 230}'`
  201. fi
  202. if `test ! -s ./rexmacs/putd.dme`
  203. then
  204. echo "writing ./rexmacs/putd.dme"
  205. cat > ./rexmacs/putd.dme << '\Rogue\Monster\'
  206. /*   Saves the marked block as a file with the filename specified by     */
  207. /*   the 1st argument, and then deletes it from the file being edited.   */
  208. /*   If no name is specified, the block is written to file "t:$bsave".   */
  209. /*   Arguments following the 1st one are ignored.                        */
  210. /*                                                                       */
  211. /*   Kim DeVaughn  12/28/87                                              */
  212.  
  213. options failat 5
  214. rc = 0
  215.  
  216. parse arg filename junk
  217. if filename = ""
  218.    then bsave "t:$bsave"
  219.    else bsave  filename
  220. bdelete
  221. exit rc
  222.  
  223. \Rogue\Monster\
  224. else
  225.   echo "will not over write ./rexmacs/putd.dme"
  226. fi
  227. if [ `wc -c ./rexmacs/putd.dme | awk '{printf $1}'` -ne 589 ]
  228. then
  229. echo `wc -c ./rexmacs/putd.dme | awk '{print "Got " $1 ", Expected " 589}'`
  230. fi
  231. if `test ! -s ./rexmacs/two.dme`
  232. then
  233. echo "writing ./rexmacs/two.dme"
  234. cat > ./rexmacs/two.dme << '\Rogue\Monster\'
  235. /* test to see if we can invoke ARexx from inside of dme .... */
  236.  
  237. parse source a b c d e f g h i
  238. say a b c d e f g h i
  239. parse arg j k l m n o
  240. say j k l m n o
  241. say "two ... calling three"
  242. three
  243. say "back to two"
  244. exit 0
  245.  
  246. \Rogue\Monster\
  247. else
  248.   echo "will not over write ./rexmacs/two.dme"
  249. fi
  250. if [ `wc -c ./rexmacs/two.dme | awk '{printf $1}'` -ne 217 ]
  251. then
  252. echo `wc -c ./rexmacs/two.dme | awk '{print "Got " $1 ", Expected " 217}'`
  253. fi
  254. if `test ! -s ./rexmacs/interr2.dme`
  255. then
  256. echo "writing ./rexmacs/interr2.dme"
  257. cat > ./rexmacs/interr2.dme << '\Rogue\Monster\'
  258. /* test to see if we can invoke ARexx from inside of dme .... */
  259.  
  260. parse source a b c d e f g h i
  261. say a b c d e f g h i
  262. parse arg j k l m n o
  263. say j k l m n o
  264. say "do an else all by itself ..."
  265. else
  266. say "shoulda caused an error ..."
  267. exit 0
  268.  
  269. \Rogue\Monster\
  270. else
  271.   echo "will not over write ./rexmacs/interr2.dme"
  272. fi
  273. if [ `wc -c ./rexmacs/interr2.dme | awk '{printf $1}'` -ne 239 ]
  274. then
  275. echo `wc -c ./rexmacs/interr2.dme | awk '{print "Got " $1 ", Expected " 239}'`
  276. fi
  277. if `test ! -s ./rexmacs/swish.dme`
  278. then
  279. echo "writing ./rexmacs/swish.dme"
  280. cat > ./rexmacs/swish.dme << '\Rogue\Monster\'
  281. /* test to see if we can invoke ARexx from inside of dme .... */
  282.  
  283. bottom
  284. top
  285. bottom
  286. top
  287. bottom
  288. top
  289. bottom
  290. top
  291. bottom
  292. top
  293. find "rexx"
  294. exit 0
  295.  
  296. \Rogue\Monster\
  297. else
  298.   echo "will not over write ./rexmacs/swish.dme"
  299. fi
  300. if [ `wc -c ./rexmacs/swish.dme | awk '{printf $1}'` -ne 141 ]
  301. then
  302. echo `wc -c ./rexmacs/swish.dme | awk '{print "Got " $1 ", Expected " 141}'`
  303. fi
  304. if `test ! -s ./rexmacs/xx.dme`
  305. then
  306. echo "writing ./rexmacs/xx.dme"
  307. cat > ./rexmacs/xx.dme << '\Rogue\Monster\'
  308. /* test to see if we can invoke ARexx from inside of dme .... */
  309.  
  310. yy
  311. bottom
  312. top
  313. bottom
  314. top
  315. bottom
  316. top
  317. bottom
  318. top
  319. bottom
  320. top
  321. find "rexx"
  322. yy
  323. exit 0
  324.  
  325. \Rogue\Monster\
  326. else
  327.   echo "will not over write ./rexmacs/xx.dme"
  328. fi
  329. if [ `wc -c ./rexmacs/xx.dme | awk '{printf $1}'` -ne 147 ]
  330. then
  331. echo `wc -c ./rexmacs/xx.dme | awk '{print "Got " $1 ", Expected " 147}'`
  332. fi
  333. if `test ! -s ./rexmacs/three.dme`
  334. then
  335. echo "writing ./rexmacs/three.dme"
  336. cat > ./rexmacs/three.dme << '\Rogue\Monster\'
  337. /* test to see if we can invoke ARexx from inside of dme .... */
  338.  
  339. parse source a b c d e f g h i
  340. say a b c d e f g h i
  341. parse arg j k l m n o
  342. say j k l m n o
  343. say "three here"
  344. exit 0
  345.  
  346. \Rogue\Monster\
  347. else
  348.   echo "will not over write ./rexmacs/three.dme"
  349. fi
  350. if [ `wc -c ./rexmacs/three.dme | awk '{printf $1}'` -ne 182 ]
  351. then
  352. echo `wc -c ./rexmacs/three.dme | awk '{print "Got " $1 ", Expected " 182}'`
  353. fi
  354. if `test ! -s ./rexmacs/alley.dme`
  355. then
  356. echo "writing ./rexmacs/alley.dme"
  357. cat > ./rexmacs/alley.dme << '\Rogue\Monster\'
  358. /* test to see if we can invoke ARexx from inside of dme .... */
  359. say "Gee ... I really did get called!!!"
  360. say address()
  361. options failat 4
  362. shit
  363. say "RC = " RC
  364. damn
  365. say "RC = " RC
  366. and hell
  367. say "RC = " RC
  368. it
  369. say "RC = " RC
  370. dont
  371. say "RC = " RC
  372. matter to me
  373. say "RC = " RC
  374. exit(69)
  375.  
  376. \Rogue\Monster\
  377. else
  378.   echo "will not over write ./rexmacs/alley.dme"
  379. fi
  380. if [ `wc -c ./rexmacs/alley.dme | awk '{printf $1}'` -ne 277 ]
  381. then
  382. echo `wc -c ./rexmacs/alley.dme | awk '{print "Got " $1 ", Expected " 277}'`
  383. fi
  384. if `test ! -s ./rexmacs/save.dme`
  385. then
  386. echo "writing ./rexmacs/save.dme"
  387. cat > ./rexmacs/save.dme << '\Rogue\Monster\'
  388. /*   Saves the file with the filename specified by the 1st argument.   */
  389. /*   If no name is specified, the file is saved with it's original     */
  390. /*   filename.  Arguments following the 1st one are ignored.           */
  391. /*                                                                     */
  392. /*   Kim DeVaughn  12/21/87                                            */
  393.  
  394. options failat 5
  395. rc = 0
  396.  
  397. parse arg filename junk
  398. if filename = ""
  399.    then saveold
  400.    else saveas  filename
  401. exit rc
  402.  
  403. \Rogue\Monster\
  404. else
  405.   echo "will not over write ./rexmacs/save.dme"
  406. fi
  407. if [ `wc -c ./rexmacs/save.dme | awk '{printf $1}'` -ne 487 ]
  408. then
  409. echo `wc -c ./rexmacs/save.dme | awk '{print "Got " $1 ", Expected " 487}'`
  410. fi
  411. if `test ! -s ./rexmacs/xyz2.dme`
  412. then
  413. echo "writing ./rexmacs/xyz2.dme"
  414. cat > ./rexmacs/xyz2.dme << '\Rogue\Monster\'
  415. /* test to see if we can invoke ARexx from inside of dme .... */
  416.  
  417. parse source a b c d e f g h i
  418. say a b c d e f g h i
  419. parse arg j k l m n o
  420. say j k l m n o
  421. say "back to xyz1.dme"
  422. exit 0
  423.  
  424. \Rogue\Monster\
  425. else
  426.   echo "will not over write ./rexmacs/xyz2.dme"
  427. fi
  428. if [ `wc -c ./rexmacs/xyz2.dme | awk '{printf $1}'` -ne 188 ]
  429. then
  430. echo `wc -c ./rexmacs/xyz2.dme | awk '{print "Got " $1 ", Expected " 188}'`
  431. fi
  432. if `test ! -s ./rexmacs/rxtop.dme`
  433. then
  434. echo "writing ./rexmacs/rxtop.dme"
  435. cat > ./rexmacs/rxtop.dme << '\Rogue\Monster\'
  436. /* give 'em a TOP command */
  437. top
  438. say "RC for TOP = " RC
  439. exit
  440.  
  441. \Rogue\Monster\
  442. else
  443.   echo "will not over write ./rexmacs/rxtop.dme"
  444. fi
  445. if [ `wc -c ./rexmacs/rxtop.dme | awk '{printf $1}'` -ne 62 ]
  446. then
  447. echo `wc -c ./rexmacs/rxtop.dme | awk '{print "Got " $1 ", Expected " 62}'`
  448. fi
  449. if `test ! -s ./rexmacs/addr.dme`
  450. then
  451. echo "writing ./rexmacs/addr.dme"
  452. cat > ./rexmacs/addr.dme << '\Rogue\Monster\'
  453. /* test to see if we can invoke ARexx from inside of dme .... */
  454.  
  455. parse source a b c d e f g h i
  456. say a b c d e f g h i
  457. parse arg j k l m n o
  458. say j k l m n o
  459. second fee fi foe foo
  460. second
  461. say Back to addr.dme
  462. exit 0
  463.  
  464. \Rogue\Monster\
  465. else
  466.   echo "will not over write ./rexmacs/addr.dme"
  467. fi
  468. if [ `wc -c ./rexmacs/addr.dme | awk '{printf $1}'` -ne 215 ]
  469. then
  470. echo `wc -c ./rexmacs/addr.dme | awk '{print "Got " $1 ", Expected " 215}'`
  471. fi
  472. if `test ! -s ./rexmacs/zz.dme`
  473. then
  474. echo "writing ./rexmacs/zz.dme"
  475. cat > ./rexmacs/zz.dme << '\Rogue\Monster\'
  476. /* test to see if we can invoke ARexx from inside of dme .... */
  477.  
  478. bottom
  479. top
  480. bottom
  481. top
  482. bottom
  483. top
  484. bottom
  485. top
  486. bottom
  487. top
  488. find "ARexx"
  489. say foo
  490. parse source a b c d e f g h i
  491. say a b c d e f g h i
  492. exit 0
  493.  
  494. \Rogue\Monster\
  495. else
  496.   echo "will not over write ./rexmacs/zz.dme"
  497. fi
  498. if [ `wc -c ./rexmacs/zz.dme | awk '{printf $1}'` -ne 203 ]
  499. then
  500. echo `wc -c ./rexmacs/zz.dme | awk '{print "Got " $1 ", Expected " 203}'`
  501. fi
  502. if `test ! -s ./rexmacs/bot.dme`
  503. then
  504. echo "writing ./rexmacs/bot.dme"
  505. cat > ./rexmacs/bot.dme << '\Rogue\Monster\'
  506. /*   Just make "bot" a synonym/alias for "bottom".   */
  507. /*                                                   */
  508. /*   Kim DeVaughn  12/21/87                          */
  509.  
  510. bottom
  511. exit 0
  512.  
  513. \Rogue\Monster\
  514. else
  515.   echo "will not over write ./rexmacs/bot.dme"
  516. fi
  517. if [ `wc -c ./rexmacs/bot.dme | awk '{printf $1}'` -ne 184 ]
  518. then
  519. echo `wc -c ./rexmacs/bot.dme | awk '{print "Got " $1 ", Expected " 184}'`
  520. fi
  521. if `test ! -s ./rexmacs/cat.dme`
  522. then
  523. echo "writing ./rexmacs/cat.dme"
  524. cat > ./rexmacs/cat.dme << '\Rogue\Monster\'
  525. /* test to see if we can invoke ARexx from inside of dme .... */
  526.  
  527. parse source a b c d e f g h i
  528. say a b c d e f g h i
  529. parse arg j k l m n o
  530. say j k l m n o
  531.  
  532.  
  533. options failat 100
  534.  
  535. shit
  536. damn
  537. and hell
  538.  
  539. it
  540. dont
  541. matter to me
  542. exit(69)
  543.  
  544. \Rogue\Monster\
  545. else
  546.   echo "will not over write ./rexmacs/cat.dme"
  547. fi
  548. if [ `wc -c ./rexmacs/cat.dme | awk '{printf $1}'` -ne 230 ]
  549. then
  550. echo `wc -c ./rexmacs/cat.dme | awk '{print "Got " $1 ", Expected " 230}'`
  551. fi
  552. if `test ! -s ./rexmacs/get.dme`
  553. then
  554. echo "writing ./rexmacs/get.dme"
  555. cat > ./rexmacs/get.dme << '\Rogue\Monster\'
  556. /*   Inserts the file specified by the 1st argument immediately above     */
  557. /*   the line the cursor is on.  If no filename is specified, the file     */
  558. /*   "t:$bsave" is used if it exists.  Arguments following the 1st one   */
  559. /*   are ignored.                             */
  560. /*                                     */
  561. /*   Kim DeVaughn  12/21/87                         */
  562.  
  563. options failat 5
  564. rc = 0
  565.  
  566. parse arg filename junk
  567. if filename = ""
  568.    then if exists("t:$bsave")
  569.        then insfile "t:$bsave"
  570.        else nop
  571.    else insfile filename
  572. exit rc
  573.  
  574. \Rogue\Monster\
  575. else
  576.   echo "will not over write ./rexmacs/get.dme"
  577. fi
  578. if [ `wc -c ./rexmacs/get.dme | awk '{printf $1}'` -ne 477 ]
  579. then
  580. echo `wc -c ./rexmacs/get.dme | awk '{print "Got " $1 ", Expected " 477}'`
  581. fi
  582. if `test ! -s ./rexmacs/findrexx.dme`
  583. then
  584. echo "writing ./rexmacs/findrexx.dme"
  585. cat > ./rexmacs/findrexx.dme << '\Rogue\Monster\'
  586. /* findrexx */
  587. options failat 5
  588. find "rexx"
  589. exit RC
  590.  
  591. \Rogue\Monster\
  592. else
  593.   echo "will not over write ./rexmacs/findrexx.dme"
  594. fi
  595. if [ `wc -c ./rexmacs/findrexx.dme | awk '{printf $1}'` -ne 53 ]
  596. then
  597. echo `wc -c ./rexmacs/findrexx.dme | awk '{print "Got " $1 ", Expected " 53}'`
  598. fi
  599. if `test ! -s ./rexmacs/qq.dme`
  600. then
  601. echo "writing ./rexmacs/qq.dme"
  602. cat > ./rexmacs/qq.dme << '\Rogue\Monster\'
  603. /*   Just make "qq" a synonym/alias for "quit".   */
  604. /*                          */
  605. /*   Kim DeVaughn  03/27/88              */
  606.  
  607. quit
  608. exit 0
  609.  
  610. \Rogue\Monster\
  611. else
  612.   echo "will not over write ./rexmacs/qq.dme"
  613. fi
  614. if [ `wc -c ./rexmacs/qq.dme | awk '{printf $1}'` -ne 115 ]
  615. then
  616. echo `wc -c ./rexmacs/qq.dme | awk '{print "Got " $1 ", Expected " 115}'`
  617. fi
  618. if `test ! -s ./rexmacs/rxbot.dme`
  619. then
  620. echo "writing ./rexmacs/rxbot.dme"
  621. cat > ./rexmacs/rxbot.dme << '\Rogue\Monster\'
  622. /* give 'em a BOTTOM command */
  623. bottom
  624. say "RC for BOTTOM = " RC
  625. exit
  626.  
  627. \Rogue\Monster\
  628. else
  629.   echo "will not over write ./rexmacs/rxbot.dme"
  630. fi
  631. if [ `wc -c ./rexmacs/rxbot.dme | awk '{printf $1}'` -ne 71 ]
  632. then
  633. echo `wc -c ./rexmacs/rxbot.dme | awk '{print "Got " $1 ", Expected " 71}'`
  634. fi
  635. if `test ! -s ./rexmacs/findbaz.dme`
  636. then
  637. echo "writing ./rexmacs/findbaz.dme"
  638. cat > ./rexmacs/findbaz.dme << '\Rogue\Monster\'
  639. /* findbaz */
  640. find baz
  641. exit
  642.  
  643. \Rogue\Monster\
  644. else
  645.   echo "will not over write ./rexmacs/findbaz.dme"
  646. fi
  647. if [ `wc -c ./rexmacs/findbaz.dme | awk '{printf $1}'` -ne 29 ]
  648. then
  649. echo `wc -c ./rexmacs/findbaz.dme | awk '{print "Got " $1 ", Expected " 29}'`
  650. fi
  651. if `test ! -s ./rexmacs/put.dme`
  652. then
  653. echo "writing ./rexmacs/put.dme"
  654. cat > ./rexmacs/put.dme << '\Rogue\Monster\'
  655. /*   Saves the marked block as a file with the filename specified by     */
  656. /*   the 1st argument.    If no name is specified, the block is written     */
  657. /*   to file "t:$bsave".  Arguments following the 1st one are ignored.   */
  658. /*                                     */
  659. /*   Kim DeVaughn  12/21/87                         */
  660.  
  661. options failat 5
  662. rc = 0
  663.  
  664. parse arg filename junk
  665. if filename = ""
  666.    then bsave "t:$bsave"
  667.    else bsave  filename
  668. exit rc
  669.  
  670. \Rogue\Monster\
  671. else
  672.   echo "will not over write ./rexmacs/put.dme"
  673. fi
  674. if [ `wc -c ./rexmacs/put.dme | awk '{printf $1}'` -ne 399 ]
  675. then
  676. echo `wc -c ./rexmacs/put.dme | awk '{print "Got " $1 ", Expected " 399}'`
  677. fi
  678. if `test ! -s ./rexmacs/interr.dme`
  679. then
  680. echo "writing ./rexmacs/interr.dme"
  681. cat > ./rexmacs/interr.dme << '\Rogue\Monster\'
  682. /* test to see if we can invoke ARexx from inside of dme .... */
  683.  
  684. parse source a b c d e f g h i
  685. say a b c d e f g h i
  686. parse arg j k l m n o
  687. say j k l m n o
  688. say "do an else all by itself ..."
  689. /* else */
  690. say "shoulda caused an error ..."
  691. interr2 poo poo
  692. exit 0
  693.  
  694. \Rogue\Monster\
  695. else
  696.   echo "will not over write ./rexmacs/interr.dme"
  697. fi
  698. if [ `wc -c ./rexmacs/interr.dme | awk '{printf $1}'` -ne 261 ]
  699. then
  700. echo `wc -c ./rexmacs/interr.dme | awk '{print "Got " $1 ", Expected " 261}'`
  701. fi
  702. if `test ! -d ./src`
  703. then
  704.   mkdir ./src
  705.   echo "mkdir ./src"
  706. fi
  707. if `test ! -s ./src/rexx.h`
  708. then
  709. echo "writing ./src/rexx.h"
  710. cat > ./src/rexx.h << '\Rogue\Monster\'
  711. /*
  712.  *  REXX.H
  713.  *
  714.  *    (c) Copyright 1988 Kim DeVaughn, All Rights Reserved
  715.  *
  716.  *  Definitions for the ARexx interface, in addition to the ARexx includes.
  717.  *
  718.  */
  719.  
  720. #ifndef REXX_STORAGE_H
  721. #include <rexx/storage.h>
  722. #endif
  723.  
  724. #ifndef REXX_H
  725. #define REXX_H
  726.  
  727.  
  728.  
  729. /*  More RexxMsg field definitions, to make life a little easier.         */
  730.  
  731. #define  ACTION(rmp)     (rmp->rm_Action)    /* command (action) code        */
  732. #define  RESULT1(rmp)    (rmp->rm_Result1)   /* primary result (return code) */
  733. #define  RESULT2(rmp)    (rmp->rm_Result2)   /* secondary result             */
  734. #define  COMM_ADDR(rmp)  (rmp->rm_CommAddr)  /* host address (port name)     */
  735. #define  FILE_EXT(rmp)   (rmp->rm_FileExt)   /* file extension               */
  736.  
  737.  
  738.  
  739. /*
  740.  *  Error Level Definitions   [ PRELIMINARY - SUBJECT TO CHANGE ]
  741.  *
  742.  *  Definitions for internal  (dme)  error reporting begin with CMD_
  743.  *  Definitions for external (ARexx) error reporting begin with MAC_
  744.  *
  745.  *
  746.  *         0 - command execution successful [normal]       (i.e., title = OK)
  747.  *         1 - command execution successful [alternate]  (i.e., title = OK)
  748.  *         2 - command execution successful [normal]       (don't alter title)
  749.  *         3 - command execution successful [alternate]  (don't alter title)
  750.  *         4 - reserved
  751.  *         5 - command could not complete requested function
  752.  *        10 - command was unable to process correctly
  753.  *        20 - command failure detected - data integrity in question
  754.  *        50 - internal error detected by  dme  or  ARexx
  755.  *
  756.  *  Only levels 0 and 1 allow the ARexx interface code to explicitly set title.
  757.  *
  758.  *
  759.  *  Eg:      0 - the normal case ("OK")
  760.  *         1 - a secondary succeeful result ("OK")
  761.  *         2 - normal, but may have put up an informational message
  762.  *         3 - secondary normal, but may have informational message
  763.  *         4 -
  764.  *         5 - "find" didn't find, "file not found", "block not marked", etc.
  765.  *        10 - "command not found", "syntax error", etc.
  766.  *        15 - a sever failure; "write failed", "unable to open write file", etc.
  767.  *        20 - maybe a sequence of commands that failed; may have modified data
  768.  *        50 - dunno, but definitely bad shit
  769.  */
  770.  
  771. #define  CMD_VALID0        0
  772. #define  CMD_VALID1        1
  773. #define  CMD_VALID2        2
  774. #define  CMD_VALID3        3
  775. #define  CMD_VALID4        4
  776. #define  CMD_FAILED        5
  777. #define  CMD_ERROR       10
  778. #define  CMD_SEVERE       15
  779. #define  CMD_ABORT       20
  780. #define  CMD_MALFUNCTION   50
  781.  
  782.  
  783. /*  Similar to the internal command error levels above, for the moment. */
  784.  
  785. #define  MAC_VALID0        0
  786. #define  MAC_VALID1        1
  787. #define  MAC_VALID2        2
  788. #define  MAC_VALID3        3
  789. #define  MAC_VALID4        4
  790. #define  MAC_FAILED        5
  791. #define  MAC_ERROR       10
  792. #define  MAC_SEVERE       15
  793. #define  MAC_ABORT       20
  794. #define  MAC_MALFUNCTION   50
  795.  
  796.  
  797. #define  CMD_INITIAL       0
  798. #define  TITLE_THRESHHOLD  CMD_VALID1
  799.  
  800. #endif
  801.  
  802. \Rogue\Monster\
  803. else
  804.   echo "will not over write ./src/rexx.h"
  805. fi
  806. if [ `wc -c ./src/rexx.h | awk '{printf $1}'` -ne 2817 ]
  807. then
  808. echo `wc -c ./src/rexx.h | awk '{print "Got " $1 ", Expected " 2817}'`
  809. fi
  810. if `test ! -s ./src/defs.h`
  811. then
  812. echo "writing ./src/defs.h"
  813. cat > ./src/defs.h << '\Rogue\Monster\'
  814.  
  815. /*
  816.  * DEFS.H
  817.  *
  818.  *    (C)Copyright 1987 by Matthew Dillon, All Rights Reserved
  819.  *
  820.  *    ARexx support added 03/19/88  -  Kim DeVaughn
  821.  *
  822.  */
  823.  
  824. #define AREXX 1
  825.  
  826. #include <exec/types.h>
  827. #include <exec/io.h>
  828. #include <devices/keymap.h>
  829. #include <devices/console.h>
  830. #include <exec/memory.h>
  831. #include <intuition/intuition.h>
  832. #include <workbench/icon.h>
  833. #include <workbench/startup.h>
  834. #include <workbench/workbench.h>
  835. #include <local/typedefs.h>
  836. #include <local/xmisc.h>
  837.  
  838. #if AREXX
  839. #include "rexx/storage.h"
  840. #include "rexx/rxslib.h"
  841. #include "rexx/rexxio.h"
  842. #include "rexx/errors.h"
  843. #endif
  844.  
  845.  
  846. #define MAXTOGGLE   256
  847. #define QMOVE        (0x6B|0x80)
  848.  
  849. #define COLT(n)  (XTbase + (n) * Xsize)
  850. #define ROWT(n)  (YTbase + (n) * Ysize)
  851. #define COL(n)   (Xbase  + (n) * Xsize)
  852. #define ROW(n)   (Ybase  + (n) * Ysize)
  853.  
  854. typedef struct WBStartup  WBS;
  855. typedef struct DiskObject DISKOBJ;
  856.  
  857. extern WBS    *Wbs;
  858. extern DISKOBJ    *Do;
  859.  
  860. extern short Xsize, Ysize;
  861. extern short XTbase, YTbase;
  862. extern short Rows, Columns;
  863. extern short Xbase, Ybase;
  864. extern short Xpixs, Ypixs;
  865. extern ubyte *av[];
  866. extern char Wdisable;
  867.  
  868. typedef struct _ED {
  869.     MNODE Node;
  870.     WIN *Win;
  871.     FONT *Font;         /*    da font, da font!            */
  872.     long Topline, Topcolumn;
  873.     long Line, Column;
  874.     long Lines, Maxlines;
  875.     ubyte **List;
  876.     ubyte Name[64];
  877.     ubyte Wtitle[130];
  878.     char Modified;
  879.     ubyte Tabstop;
  880.     ubyte Margin;
  881.     char Insertmode;
  882.     char IgnoreCase;
  883.     char Wordwrap;
  884.     char iconmode;        /*    window in icon mode            */
  885.     short Winx;         /*    save state of non-icon window        */
  886.     short Winy;
  887.     short Winwidth;
  888.     short Winheight;
  889.     short IWinx, IWiny;     /*    save state of icon window        */
  890.     long  dirlock;        /* directory lock                */
  891. } ED;
  892.  
  893. extern long  BSline, BEline;
  894. extern short BSchar, BEchar;
  895. extern ED    *BEp;
  896.  
  897.  
  898. #ifndef NULL
  899. #define NULL 0
  900. #endif
  901. #ifdef E
  902. #undef E
  903. #endif
  904.  
  905. extern MLIST DBase;
  906. extern MLIST PBase;
  907. extern ED    *Ep;
  908.  
  909. extern char    Overide;
  910. extern char    Savetabs;
  911. extern char    memoryfail, Nsu, Msgchk;
  912. extern ubyte    CtlC;
  913. extern ubyte    Current[256];
  914. extern ubyte    Space[32];
  915. extern short    Clen;
  916. extern char    Abortcommand, MShowTitle;
  917. extern char    Comlinemode;
  918. extern RP    *Rp;
  919. extern WIN    *Win;
  920. extern char    *Partial;
  921. extern char    *String;
  922.  
  923. extern ubyte    *allocl(), *allocb();
  924. extern char    *keyspectomacro();
  925. extern char    *menutomacro();
  926. extern char    *getvar();
  927. extern char    *GetDEnv();
  928. extern ED    *finded();
  929.  
  930. extern void    search_operation();
  931. extern void    *malloc(), *AllocMem(), *strcpy();
  932.  
  933. extern long    Dirlock;
  934.  
  935. extern PORT    *IPCPort;
  936. extern long    DResBase;
  937.  
  938. \Rogue\Monster\
  939. else
  940.   echo "will not over write ./src/defs.h"
  941. fi
  942. if [ `wc -c ./src/defs.h | awk '{printf $1}'` -ne 2549 ]
  943. then
  944. echo `wc -c ./src/defs.h | awk '{print "Got " $1 ", Expected " 2549}'`
  945. fi
  946. if `test ! -s ./src/cmd1.c`
  947. then
  948. echo "writing ./src/cmd1.c"
  949. cat > ./src/cmd1.c << '\Rogue\Monster\'
  950.  
  951.  
  952. /*
  953.  * CMD1.C   (was TEXT1.C)
  954.  *
  955.  *    (C)Copyright 1987 by Matthew Dillon,    All Rights Reserved
  956.  */
  957.  
  958. #include "defs.h"
  959.  
  960. #define nomemory()  { memoryfail = 1; }
  961.  
  962. char RecallBuf[256];
  963.  
  964. setpen(line)
  965. {
  966.     register short pen = (Ep == BEp && line >= BSline && line <= BEline) ? 2 : 1;
  967.     if (Comlinemode)
  968.     pen = 1;
  969.     if (pen != Rp->FgPen)
  970.     SetAPen(Rp, pen);
  971. }
  972.  
  973. text_init()
  974. {
  975.     register ED *e;
  976.     register ED *ep = Ep;
  977.  
  978.     text_switch(NULL);
  979.     e = (ED *)allocb(sizeof(ED));
  980.     if (e == NULL)
  981.     return(0);
  982.     bzero(e, sizeof(ED));
  983.     e->Win = Win;
  984.     if (ep) {
  985.     e->dirlock = DupLock(ep->dirlock);
  986.     e->Insertmode = ep->Insertmode;
  987.     e->IgnoreCase = ep->IgnoreCase;
  988.     e->Tabstop    = ep->Tabstop;
  989.     e->Wordwrap   = ep->Wordwrap;
  990.     if (ep->Font) {
  991.         e->Font = ep->Font;
  992.         ++e->Font->tf_Accessors;
  993.         SetFont(Win->RPort, e->Font);
  994.     }
  995.     } else {
  996.     PROC *proc = (PROC *)FindTask(NULL);
  997.     e->dirlock = DupLock(proc->pr_CurrentDir);
  998.     e->Insertmode = 1;
  999.     e->Tabstop = 4;
  1000.     }
  1001.     e->Lines = 1;
  1002.     e->Maxlines = 32;
  1003.     e->List = (ubyte **)allocl(e->Maxlines);
  1004.     e->List[0] = allocb(1);
  1005.     e->List[0][0] = Current[0] = Clen = 0;
  1006.     e->IWiny = 16;
  1007.     AddHead(&DBase, e);
  1008.     strcpy(e->Name, "unnamed");
  1009.     Ep = e;
  1010.     text_cursor(1);
  1011.     return(1);
  1012. }
  1013.  
  1014.  
  1015. text_switch(win)
  1016. WIN *win;
  1017. {
  1018.     register ED *e;
  1019.  
  1020.     if (win)
  1021.     text_sync();
  1022.     if (win) {
  1023.     for (e = (ED *)DBase.mlh_Head; e->Node.mln_Succ; e = (ED *)e->Node.mln_Succ) {
  1024.         if (e->Win == win) {
  1025.         Ep = e;
  1026.         Win = win;
  1027.         Rp = Win->RPort;
  1028.         text_load();
  1029.         if (!Ep->iconmode) {
  1030.             set_window_params();
  1031.             window_title();
  1032.         }
  1033.         return(1);
  1034.         }
  1035.     }
  1036.     return(0);
  1037.     }
  1038. }
  1039.  
  1040.  
  1041. text_sync()
  1042. {
  1043.     register ED *ep = Ep;
  1044.     char redraw = 0;
  1045.     short len;
  1046.     ubyte *ptr;
  1047.  
  1048.     for (len = strlen(Current) - 1; len >= 0 && Current[len] == ' '; --len)
  1049.     Current[len] = '\0';
  1050.     Clen = len + 1;
  1051.     if (!Comlinemode) {
  1052.     if (strlen(ep->List[ep->Line]) != Clen) {
  1053.         if (ptr = allocb(Clen+1)) {
  1054.         ep->Modified = 1;
  1055.         Overide = 0;
  1056.         FreeMem(ep->List[ep->Line], strlen(ep->List[ep->Line])+1);
  1057.         ep->List[ep->Line] = ptr;
  1058.         } else {
  1059.         nomemory();
  1060.         strcpy(Current, ep->List[ep->Line]);
  1061.         Clen = strlen(Current);
  1062.         }
  1063.     } else {
  1064.         if (strcmp(ep->List[ep->Line], Current)) {
  1065.         ep->Modified = 1;
  1066.         Overide = 0;
  1067.         }
  1068.     }
  1069.     strcpy(ep->List[ep->Line], Current);
  1070.     }
  1071.     if (Nsu == 0) {
  1072.     if (ep->Column - ep->Topcolumn >= Columns || ep->Column < ep->Topcolumn) {
  1073.         redraw = 1;
  1074.         ep->Topcolumn = ep->Column - (Columns>>1);
  1075.         if (ep->Topcolumn < 0)
  1076.         ep->Topcolumn = 0;
  1077.     }
  1078.     if (ep->Line - ep->Topline >= Rows || ep->Line < ep->Topline) {
  1079.         redraw = 1;
  1080.         ep->Topline = ep->Line - (Rows>>1);
  1081.         if (ep->Topline < 0)
  1082.         ep->Topline = 0;
  1083.     }
  1084.     }
  1085.     while (ep->Column > Clen)
  1086.     Current[Clen++] = ' ';
  1087.     Current[Clen] = '\0';
  1088.     if (redraw)
  1089.     text_redisplay();
  1090.     return((int)redraw);
  1091. }
  1092.  
  1093. text_load()
  1094. {
  1095.     if (Comlinemode)
  1096.     return(0);
  1097.     strcpy(Current, Ep->List[Ep->Line]);
  1098.     Clen = strlen(Current);
  1099.     while (Ep->Column > Clen)
  1100.     Current[Clen++] = ' ';
  1101.     Current[Clen] = '\0';
  1102. }
  1103.  
  1104. text_colno()
  1105. {
  1106.     return(Ep->Column);
  1107. }
  1108.  
  1109. text_lineno()
  1110. {
  1111.     return(Ep->Line+1);
  1112. }
  1113.  
  1114. text_lines()
  1115. {
  1116.     return(Ep->Lines);
  1117. }
  1118.  
  1119. text_cols()
  1120. {
  1121.     return((int)Clen);
  1122. }
  1123.  
  1124. text_imode()
  1125. {
  1126.     return(Ep->Insertmode);
  1127. }
  1128.  
  1129. text_tabsize()
  1130. {
  1131.     return((int)Ep->Tabstop);
  1132. }
  1133.  
  1134. ubyte *
  1135. text_name()
  1136. {
  1137.     return(Ep->Name);
  1138. }
  1139.  
  1140. text_uninit()
  1141. {
  1142.     register int i;
  1143.     register ED *ep = Ep;
  1144.  
  1145.     PMKill(ep);
  1146.     freelist(ep->List, ep->Lines);
  1147.     FreeMem(ep->List, ep->Maxlines * sizeof(char *));
  1148.  
  1149.     if (BEp == ep) {
  1150.     BEp = NULL;
  1151.     BSline = BEline = -1;
  1152.     }
  1153.     Remove(ep);
  1154.     if (ep->Font) {
  1155.     SetFont(ep->Win->RPort, ep->Win->WScreen->RastPort.Font);
  1156.     CloseFont(ep->Font);
  1157.     }
  1158.     UnLock(ep->dirlock);
  1159.     FreeMem(ep, sizeof(ED));
  1160.     if (((ED *)DBase.mlh_Head)->Node.mln_Succ) {
  1161.     Ep = (ED *)DBase.mlh_Head;
  1162.     text_load();
  1163.     } else {
  1164.     Ep = NULL;
  1165.     }
  1166. }
  1167.  
  1168. inversemode(n)
  1169. {
  1170.     if (n) {
  1171.     SetAPen(Rp, 3);
  1172.     SetDrMd(Rp, JAM2|INVERSVID);
  1173.     } else {
  1174.     setpen(Ep->Line);
  1175.     SetDrMd(Rp, JAM2);
  1176.     }
  1177. }
  1178.  
  1179. text_cursor(n)
  1180. {
  1181.     movetocursor();
  1182.     inversemode(n);
  1183.     if (Current[Ep->Column])
  1184.     Text(Rp, Current+Ep->Column, 1);
  1185.     else
  1186.     Text(Rp, " ", 1);
  1187.     inversemode(0);
  1188. }
  1189.  
  1190.  
  1191. text_position(col, row)
  1192. {
  1193.     register ED *ep = Ep;
  1194.     text_sync();
  1195.     if (col == 0)
  1196.     col = -1;
  1197.     ep->Column = ep->Topcolumn + col;
  1198.     if (ep->Column > 254)
  1199.     ep->Column = 254;
  1200.     if (ep->Column < 0)
  1201.     ep->Column = 0;
  1202.     ep->Line = ep->Topline + row;
  1203.     if (ep->Line >= ep->Lines)
  1204.     ep->Line = ep->Lines - 1;
  1205.     if (ep->Line < 0)
  1206.     ep->Line = 0;
  1207.     text_load();
  1208.     text_sync();
  1209. }
  1210.  
  1211. displayblock(on)
  1212. {
  1213.     register long start = Ep->Topline;
  1214.     register long lines = BEline - BSline + 1;
  1215.  
  1216.     if (start < BSline)
  1217.     start = BSline;
  1218.     if (!on) {
  1219.     BSline = BEline = -1;
  1220.     BEp = NULL;
  1221.     }
  1222.     if (Ep == BEp)
  1223.     text_displayseg(start - Ep->Topline, lines);
  1224. }
  1225.  
  1226. text_redrawblock(ok)
  1227. {
  1228.     WIN *savewin = NULL;
  1229.  
  1230.     if (BEp) {
  1231.     if (BEp != Ep) {
  1232.         savewin = Ep->Win;
  1233.         text_switch(BEp->Win);
  1234.     }
  1235.     if (BSline <= BEline && BSline >= 0 && BEline < Ep->Lines) {
  1236.         if (!ok) {
  1237.         BEp = NULL;
  1238.         BSline = BEline = -1;
  1239.         }
  1240.         text_displayseg(0, Rows);
  1241.     }
  1242.     if (savewin)
  1243.         text_switch(savewin);
  1244.     }
  1245.     if (!ok) {
  1246.     BEp = NULL;
  1247.     BSline = BEline = -1;
  1248.     }
  1249. }
  1250.  
  1251. text_displayseg(start, n)
  1252. {
  1253.     register short i, c;
  1254.     register ubyte *ptr;
  1255.     register ED *ep = Ep;
  1256.     char ib;
  1257.  
  1258.     if (Nsu)
  1259.     return(0);
  1260.     for (i = start; i < start + n && i < Rows && ep->Topline + i < ep->Lines; ++i) {
  1261.     if (Comlinemode) {
  1262.         if (ep->Topline + i != ep->Line)
  1263.         continue;
  1264.         ptr = Current;
  1265.         SetAPen(Rp, 1);
  1266.     } else {
  1267.         ptr = ep->List[ep->Topline + i];
  1268.         setpen(i+ep->Topline);
  1269.     }
  1270.     for (c = ep->Topcolumn; c && *ptr; ++ptr, --c);
  1271.     c = strlen(ptr);
  1272.     if (c) {
  1273.         Move(Rp, COLT(0), ROWT(i));
  1274.         Text(Rp, ptr, (c > Columns) ? Columns : c);
  1275.     }
  1276.     }
  1277. }
  1278.  
  1279. text_redisplay()
  1280. {
  1281.     if (Nsu)
  1282.     return(0);
  1283.     SetAPen(Rp, 0);
  1284.     if (Comlinemode)
  1285.     RectFill(Rp, COL(0), ROW(Rows-1), Xbase+Xpixs, Ybase+Ypixs);
  1286.     else
  1287.     RectFill(Rp, Xbase, Ybase, Xbase + Xpixs, Ybase + Ypixs);
  1288.     text_displayseg(0,Rows);
  1289. }
  1290.  
  1291. text_redisplaycurrline()
  1292. {
  1293.     int row = Ep->Line - Ep->Topline;
  1294.  
  1295.     if (Nsu)
  1296.     return(0);
  1297.     SetAPen(Rp, 0);
  1298.     RectFill(Rp, COL(0), ROW(row), Xbase+Xpixs, ROW(row+1)-1);
  1299.     text_displayseg(row, 1);
  1300. }
  1301.  
  1302. text_write(str)
  1303. ubyte *str;
  1304. {
  1305.     register short len = strlen(str);
  1306.     register short i;
  1307.     register ED *ep = Ep;
  1308.  
  1309.     if (Clen + len >= 255) {
  1310.     text_sync();
  1311.     text_load();
  1312.     }
  1313.     if (ep->Insertmode == 0) {
  1314.     if (ep->Column + len >= 255)
  1315.         goto fail;
  1316.     bmov(str, Current + ep->Column, len);
  1317.     if (ep->Column + len >= Clen)
  1318.         Clen = ep->Column + len;
  1319.     Current[Clen] = 0;
  1320.     } else {
  1321.     if (Clen + len >= 255)
  1322.         goto fail;
  1323.     bmov(Current + ep->Column, Current + ep->Column + len, Clen+1-ep->Column);
  1324.     bmov(str, Current + ep->Column, len);
  1325.     Clen += len;
  1326.     if (len < Columns - (ep->Column - ep->Topcolumn)) {
  1327.         ScrollRaster(Rp, -len * Xsize, 0 ,
  1328.         COL(ep->Column - ep->Topcolumn),
  1329.         ROW(ep->Line - ep->Topline),
  1330.         COL(Columns) - 1,
  1331.         ROW(ep->Line - ep->Topline + 1) - 1
  1332.         );
  1333.     }
  1334.     }
  1335.     i = (ep->Column - ep->Topcolumn + len > Columns) ? Columns - ep->Column + ep->Topcolumn : len;
  1336.     setpen(ep->Line);
  1337.     Move(Rp, COLT(ep->Column - ep->Topcolumn), ROWT(ep->Line - ep->Topline));
  1338.     Text(Rp, str, i);
  1339.     ep->Column += len;
  1340.     if (ep->Column - ep->Topcolumn >= Columns)
  1341.     text_sync();
  1342. fail:
  1343.     if (Comlinemode == 0 && ep->Wordwrap)
  1344.     do_reformat(0);
  1345. }
  1346.  
  1347.  
  1348. do_up()
  1349. {
  1350.     if (Ep->Line) {
  1351.     text_sync();
  1352.     --Ep->Line;
  1353.     text_load();
  1354.     if (Ep->Line < Ep->Topline) {
  1355.         if (Nsu == 0) {
  1356.         ScrollRaster(Rp,0,-Ysize,COL(0),ROW(0),COL(Columns)-1,ROW(Rows)-1);
  1357.         --Ep->Topline;
  1358.         text_displayseg(0, 1);
  1359.         }
  1360.     }
  1361.     } else {
  1362.     Abortcommand = 1;
  1363.     }
  1364. }
  1365.  
  1366. do_scrolldown()
  1367. {
  1368.     if (Ep->Topline + Rows < Ep->Lines) {
  1369.     if (Nsu == 0) {
  1370.         text_sync();
  1371.         ScrollRaster(Rp,0,Ysize,COL(0),ROW(0),COL(Columns)-1,ROW(Rows)-1);
  1372.         ++Ep->Topline;
  1373.         ++Ep->Line;
  1374.         text_load();
  1375.         text_displayseg(Rows-1, 1);
  1376.     }
  1377.     } else {
  1378.     Abortcommand = 1;
  1379.     }
  1380. }
  1381.  
  1382. do_scrollup()
  1383. {
  1384.     if (Ep->Topline) {
  1385.     if (Nsu == 0) {
  1386.         text_sync();
  1387.         ScrollRaster(Rp,0,-Ysize,COL(0),ROW(0),COL(Columns)-1,ROW(Rows)-1);
  1388.         --Ep->Topline;
  1389.         --Ep->Line;
  1390.         text_load();
  1391.         text_displayseg(0, 1);
  1392.     }
  1393.     } else {
  1394.     Abortcommand = 1;
  1395.     }
  1396. }
  1397.  
  1398. do_down()
  1399. {
  1400.     if (Ep->Line + 1 < Ep->Lines) {
  1401.     text_sync();
  1402.     ++Ep->Line;
  1403.     text_load();
  1404.     if (Ep->Line - Ep->Topline >= Rows) {
  1405.         if (Nsu == 0) {
  1406.         ScrollRaster(Rp,0,Ysize,COL(0),ROW(0),COL(Columns)-1,ROW(Rows)-1);
  1407.         ++Ep->Topline;
  1408.         text_displayseg(Rows-1, 1);
  1409.         }
  1410.     }
  1411.     } else {
  1412.     Abortcommand = 1;
  1413.     }
  1414. }
  1415.  
  1416. /*
  1417.  *  PAGEUP
  1418.  *  PAGEDOWN
  1419.  *  PAGESET n    (n = 0 to 100 for percentage of #rows to scroll, minimum 1)
  1420.  *        can be > 100.
  1421.  */
  1422.  
  1423. do_page()
  1424. {
  1425.     register int n, multiplier = 1;
  1426.     register ED *ep = Ep;
  1427.     static short pctg = 80;
  1428.  
  1429.     switch(av[0][4]) {
  1430.     case 'u':
  1431.     multiplier = -1;
  1432.     case 'd':
  1433.     n = multiplier * Rows * pctg / 100;
  1434.     if (!n)
  1435.         n = multiplier;
  1436.     if (n > 0 && ep->Topline >= ep->Lines - Rows)
  1437.         return(0);
  1438.     text_sync();
  1439.     ep->Line += n;
  1440.     ep->Topline += n;
  1441.     if (ep->Line >= ep->Lines)
  1442.         ep->Line = ep->Lines - 1;
  1443.     if (ep->Line < 0)
  1444.         ep->Line = 0;
  1445.     if (ep->Topline >= ep->Lines)
  1446.         ep->Topline = ep->Lines - Rows - 1;
  1447.     if (ep->Topline < 0)
  1448.         ep->Topline = 0;
  1449.     text_load();
  1450.     if (!text_sync())
  1451.         text_redisplay();
  1452.     break;
  1453.     case 's':
  1454.     pctg = atoi(av[1]);
  1455.     break;
  1456.     }
  1457. }
  1458.  
  1459.  
  1460. do_downadd()
  1461. {
  1462.     ubyte *ptr;
  1463.  
  1464.     if (Ep->Line + 1 == Ep->Lines) {
  1465.     Ep->Modified = 1;
  1466.     if (makeroom(32) && (ptr = allocb(1))) {
  1467.         Ep->List[Ep->Lines] = ptr;
  1468.         *ptr = 0;
  1469.         ++Ep->Lines;
  1470.     } else {
  1471.         nomemory();
  1472.     }
  1473.     }
  1474.     do_down();
  1475. }
  1476.  
  1477.  
  1478. do_left()
  1479. {
  1480.     if (Ep->Column) {
  1481.     --Ep->Column;
  1482.     if (Ep->Column < Ep->Topcolumn)
  1483.         text_sync();
  1484.     } else {
  1485.     Abortcommand = 1;
  1486.     }
  1487. }
  1488.  
  1489. do_right()
  1490. {
  1491.     if (Ep->Column != 254) {
  1492.     if (Current[Ep->Column] == 0) {
  1493.         Current[Ep->Column] = ' ';
  1494.         Current[Ep->Column+1]= '\0';
  1495.         ++Clen;
  1496.     }
  1497.     ++Ep->Column;
  1498.     if (Ep->Column - Ep->Topcolumn >= Columns)
  1499.         text_sync();
  1500.     } else {
  1501.     Abortcommand = 1;
  1502.     }
  1503. }
  1504.  
  1505. do_tab()
  1506. {
  1507.     register short n;
  1508.  
  1509.     for (n = Ep->Tabstop-(Ep->Column % Ep->Tabstop); n > 0; --n)
  1510.     do_right();
  1511. }
  1512.  
  1513. do_backtab()
  1514. {
  1515.     register short n;
  1516.  
  1517.     n = Ep->Column % Ep->Tabstop;
  1518.     if (!n)
  1519.     n = Ep->Tabstop;
  1520.     for (; n > 0; --n)
  1521.     do_left();
  1522. }
  1523.  
  1524. do_return()
  1525. {
  1526.     ubyte buf[256];
  1527.     char *partial;
  1528.  
  1529.     if (Comlinemode) {
  1530.     strcpy(buf, Current);
  1531.     strcpy(RecallBuf, Current);
  1532.     partial = Partial;
  1533.     Partial = NULL;
  1534.     escapecomlinemode();
  1535.     if (partial) {
  1536.         if (do_command(buf))
  1537.         do_command(partial);
  1538.         free(partial);
  1539.     } else {
  1540.         do_command(buf);
  1541.     }
  1542.     } else {
  1543.     Ep->Column = 0;
  1544.     text_sync();
  1545.     do_downadd();
  1546.     }
  1547. }
  1548.  
  1549. do_bs()
  1550. {
  1551.     register ED *ep = Ep;
  1552.     if (ep->Column) {
  1553.     bmov(Current + ep->Column, Current + ep->Column - 1, Clen - ep->Column + 1);
  1554.     --ep->Column;
  1555.     --Clen;
  1556.     if (ep->Column < ep->Topcolumn) {
  1557.         text_sync();
  1558.     } else {
  1559.         ScrollRaster(Rp, Xsize, 0,
  1560.         COL(ep->Column - ep->Topcolumn),
  1561.         ROW(ep->Line   - ep->Topline),
  1562.         COL(Columns)-1,
  1563.         ROW(ep->Line - ep->Topline + 1)-1
  1564.         );
  1565.         if (Clen >= ep->Topcolumn + Columns) {
  1566.         setpen(ep->Line);
  1567.         Move(Rp, COLT(Columns-1), ROWT(ep->Line - ep->Topline));
  1568.         Text(Rp, Current + ep->Topcolumn + Columns - 1, 1);
  1569.         }
  1570.     }
  1571.     if (Comlinemode == 0 && ep->Wordwrap)
  1572.         do_reformat(0);
  1573.     } else {
  1574.     Abortcommand = 1;
  1575.     }
  1576. }
  1577.  
  1578.  
  1579. /*
  1580.  * esc, escimm
  1581.  */
  1582.  
  1583. int Savetopline, Savecolumn, Savetopcolumn;
  1584.  
  1585. do_recall()
  1586. {
  1587.     av[0] = (ubyte *)"escimm";
  1588.     av[1] = (ubyte *)RecallBuf;
  1589.     do_esc();
  1590. }
  1591.  
  1592. do_esc()
  1593. {
  1594.     register ED *ep = Ep;
  1595.  
  1596.     if (Comlinemode)
  1597.     return(escapecomlinemode());
  1598.     text_sync();
  1599.     if (av[0][3] == 'i')
  1600.     strcpy(Current, av[1]);
  1601.     else
  1602.     Current[0] = 0;
  1603.     Clen = strlen(Current);
  1604.     Comlinemode = 1;
  1605.     returnoveride(1);
  1606.     Savetopline = ep->Topline;
  1607.     Savecolumn    = ep->Column;
  1608.     Savetopcolumn = ep->Topcolumn;
  1609.     ep->Column      = Clen;
  1610.     ep->Topcolumn = 0;
  1611.     ep->Topline   = ep->Line - Rows + 1;
  1612.     SetAPen(Rp, 0);
  1613.     RectFill(Rp, COL(0), ROW(Rows-1), Xbase+Xpixs, Ybase+Ypixs);
  1614.     SetAPen(Rp, 1);
  1615.     Move(Rp, COL(0), ROW(Rows-1) - 1);
  1616.     Draw(Rp, Xbase + Xpixs, ROW(Rows-1) - 1);
  1617.     text_displayseg(Rows-1,1);
  1618. }
  1619.  
  1620.  
  1621. escapecomlinemode()
  1622. {
  1623.     register ED *ep = Ep;
  1624.  
  1625.     if (Partial) {
  1626.     free(Partial);
  1627.     Partial = NULL;
  1628.     }
  1629.     if (Comlinemode) {
  1630.     strcpy(RecallBuf, Current);
  1631.     Comlinemode = 0;
  1632.     returnoveride(0);
  1633.     ep->Topline = Savetopline;
  1634.     ep->Column  = Savecolumn;
  1635.     ep->Topcolumn = Savetopcolumn;
  1636.     text_load();
  1637.     SetAPen(Rp, 0);
  1638.     RectFill(Rp, COL(0), ROW(Rows-1)-1, Xbase+Xpixs, Ybase+Ypixs);
  1639.     SetAPen(Rp, 1);
  1640.     text_displayseg(Rows-2,2);
  1641.     }
  1642. }
  1643.  
  1644.  
  1645. do_del()
  1646. {
  1647.     register ED *ep = Ep;
  1648.  
  1649.     if (Current[ep->Column]) {
  1650.     bmov(Current + ep->Column + 1, Current + ep->Column, Clen - ep->Column);
  1651.     --Clen;
  1652.     ScrollRaster(Rp, Xsize, 0,
  1653.         COL(ep->Column - ep->Topcolumn),
  1654.         ROW(ep->Line - ep->Topline),
  1655.         COL(Columns)-1,
  1656.         ROW(ep->Line - ep->Topline + 1) - 1
  1657.     );
  1658.     if (Clen >= ep->Topcolumn + Columns) {
  1659.         setpen(ep->Line);
  1660.         Move(Rp, COLT(Columns-1), ROWT(ep->Line-ep->Topline));
  1661.         Text(Rp, Current+ep->Topcolumn+Columns-1, 1);
  1662.     }
  1663.     if (Comlinemode == 0 && ep->Wordwrap)
  1664.         do_reformat(0);
  1665.     }
  1666. }
  1667.  
  1668. do_top()
  1669. {
  1670.     text_sync();
  1671.     Ep->Line = 0;
  1672.     text_load();
  1673.     text_sync();
  1674. }
  1675.  
  1676. do_bottom()
  1677. {
  1678.     text_sync();
  1679.     Ep->Line = Ep->Lines - 1;
  1680.     text_load();
  1681.     text_sync();
  1682. }
  1683.  
  1684. do_firstcolumn()
  1685. {
  1686.     if (Ep->Column) {
  1687.     Ep->Column = 0;
  1688.     text_sync();
  1689.     }
  1690. }
  1691.  
  1692. do_firstnb()
  1693. {
  1694.     for (Ep->Column = 0; Current[Ep->Column] == ' '; ++Ep->Column);
  1695.     if (Current[Ep->Column] == 0)
  1696.     Ep->Column = 0;
  1697.     text_sync();
  1698. }
  1699.  
  1700. do_lastcolumn()
  1701. {
  1702.     short i;
  1703.  
  1704.     text_sync();
  1705.     i = (Comlinemode) ? Clen : strlen(Ep->List[Ep->Line]);
  1706.     if (i != Ep->Column) {
  1707.     Ep->Column = i;
  1708.     text_sync();
  1709.     }
  1710. }
  1711.  
  1712. /*
  1713.  * GOTO [+/-]N
  1714.  * GOTO BLOCK    start of block
  1715.  * GOTO START    start of block
  1716.  * GOTO END    end of block
  1717.  */
  1718.  
  1719. do_goto()
  1720. {
  1721.     register short n, i;
  1722.     register ubyte *ptr = av[1];
  1723.  
  1724.     i = 0;
  1725.     n = -1;
  1726.  
  1727.     switch(*ptr) {
  1728.     case 'b':
  1729.     case 's':
  1730.     case 'B':
  1731.     case 'S':
  1732.     n = -1;
  1733.     if (Ep == BEp)
  1734.         n = BSline;
  1735.     break;
  1736.     case 'e':
  1737.     case 'E':
  1738.     n = -1;
  1739.     if (Ep == BEp)
  1740.         n = BEline;
  1741.     break;
  1742.     case '+':
  1743.     i = 1;
  1744.     case '-':
  1745.     n = Ep->Line;
  1746.     default:
  1747.     n += atoi(ptr+i);
  1748.     }
  1749.     if (n >= Ep->Lines)
  1750.     n = Ep->Lines - 1;
  1751.     if (n < 0)
  1752.     n = 0;
  1753.     text_sync();
  1754.     Ep->Line = n;
  1755.     text_load();
  1756.     text_sync();
  1757. }
  1758.  
  1759. do_screentop()
  1760. {
  1761.     text_sync();
  1762.     Ep->Line = Ep->Topline;
  1763.     text_load();
  1764.     text_sync();
  1765. }
  1766.  
  1767. do_screenbottom()
  1768. {
  1769.     text_sync();
  1770.     Ep->Line = Ep->Topline + Rows - 1;
  1771.     if (Ep->Line < 0 || Ep->Line >= Ep->Lines)
  1772.     Ep->Line = Ep->Lines - 1;
  1773.     text_load();
  1774.     text_sync();
  1775. }
  1776.  
  1777. static ubyte Fstr[256];
  1778. static ubyte Rstr[256];
  1779. static short Srch_sign;
  1780. static char Doreplace;
  1781.  
  1782. /*
  1783.  * findstr, repstr
  1784.  */
  1785.  
  1786. do_findstr()
  1787. {
  1788.     if (av[0][0] == 'f')
  1789.     strcpy(Fstr, av[1]);
  1790.     else
  1791.     strcpy(Rstr, av[1]);
  1792. }
  1793.  
  1794. /*
  1795.  * findr, nextr, prevr
  1796.  */
  1797.  
  1798. do_findr()
  1799. {
  1800.     Doreplace = 1;
  1801.     Srch_sign = 1;
  1802.     switch(av[0][0]) {
  1803.     case 'f':
  1804.     strcpy(Fstr, av[1]);
  1805.     strcpy(Rstr, av[2]);
  1806.     break;
  1807.     case 'p':
  1808.     Srch_sign = -1;
  1809.     break;
  1810.     }
  1811.     search_operation();
  1812. }
  1813.  
  1814. /*
  1815.  * find, next, prev
  1816.  */
  1817.  
  1818. do_find()
  1819. {
  1820.     Doreplace = 0;
  1821.     Srch_sign = 1;
  1822.     switch(av[0][0]) {
  1823.     case 'f':
  1824.     strcpy(Fstr, av[1]);
  1825.     break;
  1826.     case 'p':
  1827.     Srch_sign = -1;
  1828.     break;
  1829.     }
  1830.     search_operation();
  1831. }
  1832.  
  1833.  
  1834. static char CaseIgnore;
  1835.  
  1836. void
  1837. search_operation()
  1838. {
  1839.     int flen = strlen(Fstr);
  1840.     int rlen = strlen(Rstr);
  1841.     char senabled = 0;
  1842.     register ubyte *ptr;
  1843.     register int i, col;
  1844.     register ED *ep = Ep;
  1845.  
  1846.     CaseIgnore = ep->IgnoreCase;
  1847.     text_sync();
  1848.     if (!flen) {
  1849.     title("No find pattern");
  1850.     Abortcommand = 1;
  1851.     return;
  1852.     }
  1853.  
  1854.     col = ep->Column;
  1855.     if (col >= strlen(ep->List[ep->Line]))
  1856.     col = strlen(ep->List[ep->Line]);
  1857.     for (i = ep->Line;;) {
  1858.     ptr = ep->List[i];
  1859.     if (Srch_sign > 0) {
  1860.         while (ptr[col]) {
  1861.         if (senabled && case_strncmp(Fstr,ptr+col,flen) == 0)
  1862.             goto found;
  1863.         senabled = 1;
  1864.         ++col;
  1865.         }
  1866.         senabled = 1;
  1867.         if (++i >= ep->Lines)
  1868.         break;
  1869.         col = 0;
  1870.     } else {
  1871.         while (col >= 0) {
  1872.         if (senabled && case_strncmp(Fstr,ptr+col,flen) == 0)
  1873.             goto found;
  1874.         senabled = 1;
  1875.         --col;
  1876.         }
  1877.         senabled = 1;
  1878.         if (--i < 0)
  1879.         break;
  1880.         col = strlen(ep->List[i]);
  1881.     }
  1882.     }
  1883.     title("Pattern Not Found");
  1884.     Abortcommand = 1;
  1885.     return;
  1886.  
  1887. found:
  1888.     ep->Line = i;
  1889.     ep->Column = col;
  1890.  
  1891.     text_load();
  1892.     if (Doreplace) {
  1893.     if (rlen > flen && rlen-flen+strlen(ptr) > 254) {
  1894.         title("Replace: Line Too Long");
  1895.         Abortcommand = 1;
  1896.         return;
  1897.     }
  1898.     if (Clen-col-flen >= 0) {
  1899.         bmov(Current+col+flen, Current+col+rlen, Clen-col-flen+1);
  1900.         bmov(Rstr, Current+col, rlen);
  1901.         Clen += rlen-flen;
  1902.     }
  1903.     text_sync();
  1904.     text_redisplaycurrline();
  1905.     } else {
  1906.     text_sync();
  1907.     }
  1908. }
  1909.  
  1910. #asm
  1911.         ;   NOTE: assumes that one of the strings is at least
  1912.         ;      'len' bytes long, and contains no nulls.  Also,
  1913.         ;      returns only 0=success, 1=fail.  NOT A TRUE
  1914.         ;      CASE COMPARE... can get confused by control
  1915.         ;      chars.
  1916.         ;
  1917.         ;   4(sp)  = s1
  1918.         ;   8(sp)  = s2
  1919.         ;   12(sp) = len
  1920.  
  1921. _case_strncmp:
  1922.         movem.l 4(sp),A0/A1
  1923.         move.l    12(sp),D0
  1924.         move.l    D2,-(sp)
  1925.         tst.b    _CaseIgnore
  1926.         bne    .csc100
  1927.         moveq.l #0,D1        ;set Z bit    case sensitive
  1928.         bra    .csc20
  1929. .csc10        cmpm.b    (A0)+,(A1)+
  1930. .csc20        dbne    D0,.csc10
  1931.         bne    .cscfail
  1932. .cscsucc    moveq.l #0,D0        ;return true
  1933.         move.l    (sp)+,D2
  1934.         rts
  1935.  
  1936. .csc100     moveq.l #0,D1        ;set Z bit    case sensitive
  1937.         bra    .csc120
  1938. .csc110     move.b    (A0)+,D1        ;XOR two bytes together
  1939.         move.b    (A1)+,D2
  1940.         eor.b    D2,D1
  1941.         and.b    #$DF,D1     ;forget bit 5 (the case)
  1942. .csc120     dbne    D0,.csc110
  1943.         beq    .cscsucc
  1944. .cscfail    moveq.l #1,D0        ;return failure
  1945.         move.l    (sp)+,D2
  1946.         rts
  1947.  
  1948. #endasm
  1949.  
  1950. \Rogue\Monster\
  1951. else
  1952.   echo "will not over write ./src/cmd1.c"
  1953. fi
  1954. if [ `wc -c ./src/cmd1.c | awk '{printf $1}'` -ne 17766 ]
  1955. then
  1956. echo `wc -c ./src/cmd1.c | awk '{print "Got " $1 ", Expected " 17766}'`
  1957. fi
  1958. echo "Finished archive 5 of 6"
  1959. # if you want to concatenate archives, remove anything after this line
  1960. exit
  1961. -- 
  1962. Bob Page, U of Lowell CS Dept.  page@swan.ulowell.edu  ulowell!page
  1963. Have five nice days.
  1964.